Using Custom Functions to Modify Your WordPress Dashboard 您所在的位置:网站首页 how to change wordpress login logo Using Custom Functions to Modify Your WordPress Dashboard

Using Custom Functions to Modify Your WordPress Dashboard

2023-08-27 00:44| 来源: 网络整理| 查看: 265

Our function modify_admin_toolbar is hooked on admin_bar_menu with priority set to 100. You can change this priority to any integer and see how the position of new menu items is changing.

When hooking to admin_bar_menu action, we’re also passing an $admin_bar variable, which is actually being used by a default WP function that is handling admin bar rendering. This variable is an object, and with $admin_bar->add_menu we’re accessing the object’s method which is handling the admin menu items.

First, we have created one menu item called Quick Links without the parent attribute. By omitting the parent attribute we’re telling the method to render the link as a first level admin bar item.

Then, we have created two new menu items called All Settings and All Posts with Quick Links as defined parent attribute. This parent attribute matches an id of our first level admin bar item, making them appear as sub-menu items. For href attribute, we have used a WP function called admin_url().

The before and after pictures can be seen below:



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有